package com.xjrsoft.common.serializers;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.xjrsoft.core.tool.utils.DateTimeUtil;
import com.xjrsoft.core.tool.utils.StringUtil;

import java.io.IOException;
import java.time.*;
import java.time.format.DateTimeFormatter;

public class LocalDateTimeDeserializer extends JsonDeserializer<LocalDateTime> {
	@Override
	public LocalDateTime deserialize(JsonParser p, DeserializationContext deserializationContext)
			throws IOException {
		String value = p.getValueAsString();
		return DateTimeUtil.toLocalDateTime(value);
	}
}